package cn.iocoder.yudao.module.resource.dal.mysql.messagecollection;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.resource.controller.admin.messagecollection.vo.MessageCollectionPageReqVO;
import cn.iocoder.yudao.module.resource.dal.dataobject.messagecollection.MessageCollectionDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 消息仓库 Mapper
 *
 * @author lizhongwen
 */
@Mapper
public interface MessageCollectionMapper extends BaseMapperX<MessageCollectionDO> {

    default PageResult<MessageCollectionDO> selectPage(MessageCollectionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MessageCollectionDO>()
                .eqIfPresent(MessageCollectionDO::getSenderType, reqVO.getSenderType())
                .likeIfPresent(MessageCollectionDO::getUserText, reqVO.getUserText())
                .likeIfPresent(MessageCollectionDO::getReplyText, reqVO.getReplyText())
                .betweenIfPresent(MessageCollectionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MessageCollectionDO::getMessageId));
    }

}